package com.company.project.controller;

import com.company.project.entity.SysRole;
import com.company.project.entity.SysUser;
import com.company.project.mapper.SysRoleDeptMapper;
import com.company.project.service.DeptService;
import com.company.project.service.PermissionService;
import com.company.project.service.RoleService;
import com.company.project.service.UserService;
import io.swagger.annotations.Api;
import org.apache.shiro.SecurityUtils;
import org.apache.shiro.subject.Subject;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.annotation.Resource;
import java.util.List;
import java.util.stream.Collectors;

/**
 * 视图
 *
 * @author wenbin
 * @version V1.0
 * @date 2020年3月18日
 */
@Api(tags = "视图")
@Controller
@RequestMapping("/index")
public class IndexController {
    @Resource
    private UserService userService;
    @Resource
    private RoleService roleService;
    @GetMapping("/login")
    public String logout() {
        Subject subject = SecurityUtils.getSubject();
        if (subject.isAuthenticated()) {
            return "redirect:/index/home" ;
        }
        return "login" ;
    }

    @GetMapping("/home")
    public String home() {
        return "home" ;
    }
    @GetMapping("/homeOther")
    public String homeOther() {
        return "homeOther" ;
    }

    @GetMapping("/sjkb")
    public String homemain() {
       return "mainOther" ;
    }
    @GetMapping("/sjkbHome")
    public String sjkbHome() {
       return "sjkb" ;
    }
    @GetMapping("/sjkbAdmin")
    public String homemainAdmin() {
        return "main" ;
    }
    @GetMapping("/sjkbGl")
    public String homemainGL() {
      return "main" ;
    }

    @GetMapping("/users/password")
    public String updatePassword() {
        return "users/update_password" ;
    }

    @GetMapping("/users/info")
    public String userDetail(Model model) {
        model.addAttribute("flagType", "edit");
        return "users/user_edit" ;
    }

    @GetMapping("/menus")
    public String menusList() {

        return "menus/menu_list" ;
    }

    @GetMapping("/roles")
    public String roleList() {
        return "roles/role_list" ;
    }
    /**
     * 跳转到页面
     */
    @GetMapping("/tSeats")
    public String tSeats() {
        return "tseats/list";
    }
    @GetMapping("/tSeats/gly")
    public String tSeatsGly() {
        return "tseats/list_gly";
    }
    @GetMapping("/tSeats/dls")
    public String tSeatsDls() {
        return "tseats/list_dls";
    }
    @GetMapping("/tSeats/zjl")
    public String tSeatszjl() {
        return "tseats/list_zjl";
    }
    @GetMapping("/users")
    public String userList() {
        return "users/user_list" ;
    }

    @GetMapping("/logs")
    public String logList() {
        return "logs/log_list" ;
    }

    @GetMapping("/depts")
    public String deptList() {
        return "depts/dept_list" ;
    }

    @GetMapping("/403")
    public String error403() {
        return "error/403" ;
    }

    @GetMapping("/404")
    public String error404() {
        return "error/404" ;
    }

    @GetMapping("/500")
    public String error405() {
        return "error/500" ;
    }

    @GetMapping("/main")
    public String indexHome() {
        return "main" ;
    }

    @GetMapping("/about")
    public String about() {
        return "about" ;
    }

    @GetMapping("/build")
    public String build() {
        return "build" ;
    }

    @GetMapping("/sysContent")
    public String sysContent() {
        return "syscontent/list" ;
    }

    @GetMapping("/sysDict")
    public String sysDict() {
        return "sysdict/list" ;
    }

    @GetMapping("/sysGenerator")
    public String sysGenerator() {
        return "generator/list" ;
    }

    @GetMapping("/sysJob")
    public String sysJob() {
        return "sysjob/list";
    }

    @GetMapping("/sysJobLog")
    public String sysJobLog() {
        return "sysjoblog/list";
    }

    @GetMapping("/sysFiles")
    public String sysFiles() {
        return "sysfiles/list";
    }
}
